/*
This file is part of Ext JS 4.2

Copyright (c) 2011-2013 Sencha Inc

Contact:  http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as
published by the Free Software Foundation and appearing in the file LICENSE included in the
packaging of this file.

Please review the following information to ensure the GNU General Public License version 3.0
requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department
at http://www.sencha.com/contact.

Build date: 2013-05-16 14:36:50 (f9be68accb407158ba2b1be2c226a6ce1f649314)
*/
/**
 * List compiled by mystix on the extjs.com forums.
 * Thank you Mystix!
 *
 * English Translations
 * updated to 2.2 by Condor (8 Aug 2008)
 */
Ext.onReady(function() {

    if (Ext.data && Ext.data.Types) {
        Ext.data.Types.stripRe = /[\$,%]/g;
    }

    if (Ext.Date) {
        Ext.Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

        Ext.Date.getShortMonthName = function(month) {
            return Ext.Date.monthNames[month].substring(0, 3);
        };

        Ext.Date.monthNumbers = {
            Jan: 0,
            Feb: 1,
            Mar: 2,
            Apr: 3,
            May: 4,
            Jun: 5,
            Jul: 6,
            Aug: 7,
            Sep: 8,
            Oct: 9,
            Nov: 10,
            Dec: 11
        };

        Ext.Date.getMonthNumber = function(name) {
            return Ext.Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
        };

        Ext.Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

        Ext.Date.getShortDayName = function(day) {
            return Ext.Date.dayNames[day].substring(0, 3);
        };

        Ext.Date.parseCodes.S.s = "(?:st|nd|rd|th)";
    }
    
    if (Ext.util && Ext.util.Format) {
        Ext.apply(Ext.util.Format, {
            thousandSeparator: ',',
            decimalSeparator: '.',
            currencySign: '$',
            dateFormat: 'm/d/Y'
        });
    }
});

Ext.define("Ext.locale.en.view.View", {
    override: "Ext.view.View",
    emptyText: ""
});

Ext.define("Ext.locale.en.grid.plugin.DragDrop", {
    override: "Ext.grid.plugin.DragDrop",
    dragText: "{0} selected row{1}"
});

// changing the msg text below will affect the LoadMask
Ext.define("Ext.locale.en.view.AbstractView", {
    override: "Ext.view.AbstractView",
    loadingText: "Loading..."
});

Ext.define("Ext.locale.en.picker.Date", {
    override: "Ext.picker.Date",
    todayText: "Today",
    minText: "This date is before the minimum date",
    maxText: "This date is after the maximum date",
    disabledDaysText: "",
    disabledDatesText: "",
    nextText: 'Next Month (Control+Right)',
    prevText: 'Previous Month (Control+Left)',
    monthYearText: 'Choose a month (Control+Up/Down to move years)',
    todayTip: "{0} (Spacebar)",
    format: "m/d/y",
    startDay: 0
});

Ext.define("Ext.locale.en.picker.Month", {
    override: "Ext.picker.Month",
    okText: "&#160;OK&#160;",
    cancelText: "Cancel"
});

Ext.define("Ext.locale.en.toolbar.Paging", {
    override: "Ext.PagingToolbar",
    beforePageText: "Page",
    afterPageText: "of {0}",
    firstText: "First Page",
    prevText: "Previous Page",
    nextText: "Next Page",
    lastText: "Last Page",
    refreshText: "Refresh",
    displayMsg: "Displaying {0} - {1} of {2}",
    emptyMsg: 'No data to display'
});

Ext.define("Ext.locale.en.form.Basic", {
    override: "Ext.form.Basic",
    waitTitle: "Please Wait..."
});

Ext.define("Ext.locale.en.form.field.Base", {
    override: "Ext.form.field.Base",
    invalidText: "The value in this field is invalid"
});

Ext.define("Ext.locale.en.form.field.Text", {
    override: "Ext.form.field.Text",
    minLengthText: "The min length of the value is {0} &nbsp;",
    maxLengthText: "The max length of the value is {0} &nbsp;",
    blankText: "Required",
    regexText: "",
    emptyText: null
});

Ext.define("Ext.locale.en.form.field.Number", {
    override: "Ext.form.field.Number",
    decimalSeparator: ".",
    decimalPrecision: 2,
    minText: "The minimum value for this field is {0}",
    maxText: "The maximum value for this field is {0}",
    nanText: "{0} is not a valid number",
    negativeText : 'The value cannot be negative'
});

Ext.define("Ext.locale.en.form.field.Date", {
    override: "Ext.form.field.Date",
    disabledDaysText: "Disabled",
    disabledDatesText: "Disabled",
    minText: "The date in this field must be after {0}",
    maxText: "The date in this field must be before {0}",
    invalidText: "{0} is not a valid date - it must be in the format {1}",
    format: "m/d/y",
    altFormats: "m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d"
});

Ext.define("Ext.locale.en.form.field.ComboBox", {
    override: "Ext.form.field.ComboBox",
    valueNotFoundText: undefined
}, function() {
    Ext.apply(Ext.form.field.ComboBox.prototype.defaultListConfig, {
        loadingText: "Loading..."
    });
});

Ext.define("Ext.locale.en.form.field.VTypes", {
    override: "Ext.form.field.VTypes",
    emailText: 'This field should be an e-mail address in the format "user@example.com"',
    urlText: 'This field should be a URL in the format "http:/' + '/www.example.com"',
    alphaText: 'This field should only contain letters and _',
    alphanumText: 'This field should only contain letters, numbers and _'
});

Ext.define("Ext.locale.en.form.field.HtmlEditor", {
    override: "Ext.form.field.HtmlEditor",
    createLinkText: 'Please enter the URL for the link:'
}, function() {
    Ext.apply(Ext.form.field.HtmlEditor.prototype, {
        buttonTips: {
            bold: {
                title: 'Bold (Ctrl+B)',
                text: 'Make the selected text bold.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            italic: {
                title: 'Italic (Ctrl+I)',
                text: 'Make the selected text italic.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            underline: {
                title: 'Underline (Ctrl+U)',
                text: 'Underline the selected text.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            increasefontsize: {
                title: 'Grow Text',
                text: 'Increase the font size.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            decreasefontsize: {
                title: 'Shrink Text',
                text: 'Decrease the font size.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            backcolor: {
                title: 'Text Highlight Color',
                text: 'Change the background color of the selected text.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            forecolor: {
                title: 'Font Color',
                text: 'Change the color of the selected text.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifyleft: {
                title: 'Align Text Left',
                text: 'Align text to the left.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifycenter: {
                title: 'Center Text',
                text: 'Center text in the editor.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            justifyright: {
                title: 'Align Text Right',
                text: 'Align text to the right.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            insertunorderedlist: {
                title: 'Bullet List',
                text: 'Start a bulleted list.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            insertorderedlist: {
                title: 'Numbered List',
                text: 'Start a numbered list.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            createlink: {
                title: 'Hyperlink',
                text: 'Make the selected text a hyperlink.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            },
            sourceedit: {
                title: 'Source Edit',
                text: 'Switch to source editing mode.',
                cls: Ext.baseCSSPrefix + 'html-editor-tip'
            }
        }
    });
});

Ext.define("Ext.locale.en.grid.header.Container", {
    override: "Ext.grid.header.Container",
    sortAscText: "Sort Ascending",
    sortDescText: "Sort Descending",
    columnsText: "Columns"
});

Ext.define("Ext.locale.en.grid.GroupingFeature", {
    override: "Ext.grid.GroupingFeature",
    emptyGroupText: '(None)',
    groupByText: 'Group By This Field',
    showGroupsText: 'Show in Groups'
});

Ext.define("Ext.locale.en.grid.PropertyColumnModel", {
    override: "Ext.grid.PropertyColumnModel",
    nameText: "Name",
    valueText: "Value",
    dateFormat: "m/j/Y",
    trueText: "true",
    falseText: "false"
});

Ext.define("Ext.locale.en.grid.BooleanColumn", {
    override: "Ext.grid.BooleanColumn",
    trueText: "true",
    falseText: "false",
    undefinedText: '&#160;'
});

Ext.define("Ext.locale.en.grid.NumberColumn", {
    override: "Ext.grid.NumberColumn",
    format: '0,000.00'
});

Ext.define("Ext.locale.en.grid.DateColumn", {
    override: "Ext.grid.DateColumn",
    format: 'm/d/Y'
});

Ext.define("Ext.locale.en.form.field.Time", {
    override: "Ext.form.field.Time",
    minText: "The time in this field must be equal to or after {0}",
    maxText: "The time in this field must be equal to or before {0}",
    invalidText: "{0} is not a valid time",
    format: "g:i A",
    altFormats: "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H"
});

Ext.define("Ext.locale.en.form.CheckboxGroup", {
    override: "Ext.form.CheckboxGroup",
    blankText: "You must select at least one item in this group"
});

Ext.define("Ext.locale.en.form.RadioGroup", {
    override: "Ext.form.RadioGroup",
    blankText: "You must select one item in this group"
});

Ext.define("Ext.locale.en.window.MessageBox", {
    override: "Ext.window.MessageBox",
    buttonText: {
        ok: "OK",
        cancel: "Cancel",
        yes: "Yes",
        no: "No"
    }    
});

Ext.define("Ext.locale.zh_TW.hscore.widgets.form.field.DateTimePicker", {
    override: "hscore.widgets.form.field.DateTimePicker",
    okText:'OK',
    okTip:'OK',
    todayText : 'Now',
    todayTip : 'Now'  
});
// This is needed until we can refactor all of the locales into individual files
Ext.define("Ext.locale.en.Component", {	
    override: "Ext.Component"
});


Ext.define("Ext.locale.en.validation.HSVTypes", {
    override: "Ext.form.VTypes",
	'wildemailText' : 'The option should be in format of an email address，e.g.,"user@example.com" or "*@example.com"',
	
	//email
	'email' : function(v){
		return Ext.data.validations.isEmail(v);
	},
	'emailText': 'The option should be in format of an email address,ex."user@example.com"',
	
	//alpha
	'alpha': function(v, field) {
		return Ext.data.validations.isAlpha(v);
	},
	'alphaText': 'This field should only contain letters and _<br/>eg: tunnel_Tom',
	
	//字母、数字或下划线
	'alphanum': function(v, field) {
		return Ext.data.validations.isAlphaNum(v);
	},
	'alphanumText': 'This field should only contain letters, numbers and _<br/>eg: tunnel_Tom_1',
	
	//字母或数字
	'alphanumx1': function(v, field) {
		return Ext.data.validations.isAlphaNumX1(v)
	},
	'alphanumx1Text': 'The option should only include English, numbers<br/>, e.g., abc12',
	
	//IsNum
	'num': function(v, field) {
		return Ext.data.validations.isNum(v);
	},
	'numText': 'The option should only include number',
	
	//此配置项只能包含英文字母、数字、空格、"."、"-"、"_"和"@"
	'bannerstr' : function (v, field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += 'Cannot be longer than '+ maxLength+' characters or '+parseInt(maxLength/3)+' Chinese characters'; 
				Ext.form.VTypes['bannerstrText'] = tmpTips;
				return false;
			}
		}
		return Ext.data.validations.isNotContainBannerStr.test(v);
	},
	'bannerstrText' : 'The option should only include English, space, Special characters(except "),<br/> e.g. abc_12',
	
	//邮政编码
	'post': function (v, field) {
		return Ext.data.validations.isPost(v);
	},
	'postText': 'Please enter the right zip',
	
	//isp名称
	'ispNameStr': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			tmpTips += 'It cannot be null' ;
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += 'Cannot be longer than '+ maxLength+' characters or '+parseInt(maxLength/3)+' Chinese characters';
				Ext.form.VTypes['ispNameStrText'] = tmpTips;
				return false;
			}
		}
		if(field.minLength) {
			var minLength = parseInt(field.minLength, 10);
			if (Ext.data.validations.getStringByteLength(v) < minLength) {
				tmpTips += 'Should not be shorter than '+minLength+' characters or '+parseInt(minLength)+' Chinese characters';
				Ext.form.VTypes['ispNameStrText'] = tmpTips;
				return false;
			}
		}
		return Ext.data.validations.isIspNameStr(v);
		
	},
	'ispNameStrText': 'The option should only include Chinese or English characters, number, "*", "-" and "&",<br/>e.g., abc*12',
    
	//不能包含中文的字符串
	'strnozh': function(v,field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['strnozhText'] = tmpTips;
			return false;
		}
		
		if (Ext.data.validations.isEmptyString(v) == true) {
			return false;
		}
		if (Ext.data.validations.checkStrExCludeChinese(v) == false) {
			return false;
		}
		if (Ext.data.validations.strCommon(v) == false) {
			return false;
		}
		return true;
	},
	'strnozhText' : 'The option should not include Chinese characters and double quotation marks,<br/>for example：testStr_1',
	
	//不能包含双引号的字符串
	'string' : function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && Ext.data.validations.isEmptyString(v) == true) {
			tmpTips += 'It cannot be null' ;
			return false;
		}
		if(field.maxLength) {
			var maxLength = parseInt(field.maxLength, 10);
			if (Ext.data.validations.getStringByteLength(v) > maxLength) {
				tmpTips += 'Cannot be longer than ' 
							+ maxLength 
							+ ' characters or ' 
							+ parseInt(maxLength/3) 
							+ ' Chinese characters';
				Ext.form.VTypes['stringText'] = tmpTips;
				return false;
			}else{
				Ext.form.VTypes['stringText'] = this['stringText'];
			}
		}
		if(field.minLength) {
			var minLength = parseInt(field.minLength, 10);
			if (Ext.data.validations.getStringByteLength(v) < minLength) {
				tmpTips += 'Should not be shorter than '
							+ minLength +' characters or '
							+ parseInt(minLength/3) + 'Chinese characters';
				Ext.form.VTypes['stringText'] = tmpTips;
				return false;
			}else{
				Ext.form.VTypes['stringText'] = this['stringText'];
			}
		}
		return Ext.data.validations.strCommon(v);
	},
	'stringText' : 'The option should only include Chinese, English, space, Special characters(except " Tab),<br/> e.g. abc_12',
	
	//ipv6
	'ipv6': function(v, field){
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv6(v);
	},
	'ipv6Text': 'Please enter a legal IP address!',
	
	//ipv4g
	'ipv4g':  function(v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv4G(v);
	},
	'ipv4gText': 'Please enter a legal IP address, ex. 127.0.0.1 Should not be Multicast address, ex. （224.0.0.0~239.255.255.255）',
	
	//ipv4
	'ipv4':  function(v, field) {
		var tmpTips = '';

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		return Ext.data.validations.isIpv4(v);
	},
	'ipv4Text': 'Please enter a legal IP address, ex. 127.0.0.1',
	
	//ip
	'ip': function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		var ipv4_255 = false;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		ipv4_255 = Ext.data.validations.isIpv4(v, 2);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || ipv4_255 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipText' : 'Please enter a legal IP address! &nbsp;',
	
	//ip0,不能输入IP地址:0.0.0.0
	'ipo' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipoText'] = tmpTips;
			return false;
		}
		if (v == '0.0.0.0') {
			tmpTips += 'It cannot be &nbsp0.0.0.0!';
			Ext.form.VTypes['ipoText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		Ext.form.VTypes['ipoText'] = this['ipoText'];
		return false;
	},
	'ipoText' : 'Please enter a legal IP address!',
	
	//ip地址，不能为127.0.0.1
	'haip' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
		var fieldLabel = field.fieldLabel;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipText'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (!Ext.data.validations.isIpv4(v, 1)) {
			return false;
		}
		if (v == '127.0.0.1') {
			return false;
		}
		var maskField = field.haip.maskField;
		
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'haipText' : 'Please enter a legal IP address!',
	
	//ipx0
	'ipx0' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
			
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipx0Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 1);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipx0Text' : 'Please enter a legal IP address!',
	
	//ipx1
	'ipx1' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		var isIPV6 = false;
	
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipx1Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 1);
		isIPV6 = Ext.data.validations.isIpv6(v);
		if (isIPV4 || isIPV6) {
			return true;
		}
		return false;
	},
	'ipx1Text' : 'Please enter a legal gateway!',
	
	//ipx2
	'ipx2' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;

		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipx2Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 2);
		
		if (isIPV4) {			
			return true;
		}
		return false;
	},
	'ipx2Text' : 'Please enter a legal IP address!',
	
	//Mac地址
	'mac': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['macText'] = tmpTips;
			return false;
		}
		if (Ext.data.validations.isMac(v) == false) {
			return false;
		}
		if (Ext.data.validations.isBroadcastMac(v) == true) {
			tmpTips += 'This is a broadcast MAC';
			return false;
		}
		return true;
	},
	'macText': 'Please enter a legal MAC address, ex. 000c.29a8.51e9',
	
	//host id
	'hostid': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['hostidText'] = tmpTips;
			return false;
		}
		if (field.hostid) {
			var maxLength = parseInt(field.hostid.maxLength, 10);
			if (v.length != 0) {
				if (v.length != maxLength) {
					return false;
				}
			}
		}
		return true;
	},
	'hostidText': 'Please enter a legal host ID!',
	
	//dotmask
	'dotmask': function (v, field) {
		if (v.length != 0) {
			if (Ext.data.validations.isDottedNetmaskV4(v) == false) {
				return false;
			}
		}
		return true;
	},
	'dotmaskText': 'Please enter a legal netmask in dotted decimal format, ex. 255.255.255.0',
	
	//dotmaskx1
	'dotmaskx1': function (v, field) {		
		if (v.length != 0) {
			if (v == "0.0.0.0") {
				return true;
			}
			if (Ext.data.validations.isDottedNetmaskV4(v) == false) {
				return false;
			}v		}
		return true;
	},
	'dotmaskx1Text': 'Please enter a legal netmask in dotted decimal format, ex. 255.255.255.0',
	
	//nummask
	'nummask': function (v, field) {
		var tmpTips = '';
		var fieldLabel = field.fieldLabel;
		
		var maxLength = field.maxLength;
		if (v.length > maxLength) {
			return false;
		}
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['nummaskText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == false) {
				if (field.nummask) {
					var forIPV4 = Ext.getCmp(field.nummask.targetId).getValue();
					if(forIPV4 != "0.0.0.0"){
						return false;
					}
				}
			}
		}
		return true;
	},
	'nummaskText': 'Please enter a legal netmask, ex. 24',
	
	//netmask
	'netmask': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['netmaskText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmaskText': 'Please enter a legal netmask, ex. 255.255.255.0 or 24',
	
	//netmask
	'netmask1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['netmask1Text'] = tmpTips;
			return false;
		}
		if(parseInt(v,10) == 0){
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmask1Text': 'Please enter a legal netmask, ex. 255.255.255.0 or 24',
	
	//netmask2,增加对0-14的验证,0-14返回false
	'netmask2': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['netmask2Text'] = tmpTips;
			return false;
		}
		if(parseInt(v,10) == 0){
			return false;
		}
		if (v.length != 0) {
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				tmpTips = 'Please enter a legal netmask, ex. 255.255.255.0 or 24';
				Ext.form.VTypes['netmask2Text'] = tmpTips;
				return false;
			}
			if(Ext.data.validations.isNumNetmask(v, 'ipv4')){
				var num = parseInt(v, 10);
				if(num >=1 && num <= 14){
					tmpTips = 'Netmask length should be greater than 14';
					Ext.form.VTypes['netmask2Text'] = tmpTips;
					return false;
				}
			}
			else if(Ext.data.validations.isDottedNetmaskV4(v)){
				var num = hscore.utils.Utils.ipToMaskInt(v);
				if(num >=1 && num <= 14){
					tmpTips = 'Netmask length should be greater than 14';
					Ext.form.VTypes['netmask2Text'] = tmpTips;
					return false;
				}
			}
		}
		return true;
	},
	'netmask2Text': 'Please enter a legal netmask, ex. 255.255.255.0 or 24',
	
    //submask
    'submask': function (v, field) {
        var tmpTips = '';
        
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
            tmpTips += 'It cannot be null';
            Ext.form.VTypes['netmaskTextx1'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (v == "0.0.0.0" || v == "0") {
                return true;
            }
            if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
                return false;
            }
        }
        return true;
    },
    'submaskText': 'Please enter a legal submask address &nbsp;',
    
	//netmaskx1
	'netmaskx1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['netmaskTextx1'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (v == "0.0.0.0" || v == "0") {
				return true;
			}
			if (!(Ext.data.validations.isNumNetmask(v, 'ipv4') || Ext.data.validations.isDottedNetmaskV4(v))) {
				return false;
			}
		}
		return true;
	},
	'netmaskx1Text': 'Please enter a legal netmask, ex. 255.255.255.0 or 24',
	
	//wildmask
	'wildmask': function (v, field) {
		var tmpTips = '';
	
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['wildmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				return true;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				return true;
			}
			return false;
		}
		return true;
	},
	'wildmaskText': 'Please enter a legal netmask!',
	
	//wildmaskx1
	'wildmaskx1': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['wildmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				return false;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				return true;
			}
			return false;
		}
		return true;
	},
	'wildmaskx1Text': 'Please enter a legal netmask, ex. 255.255.255.0',
	
	//Wlan wep key 
	'weppwd' :  function (v,field) {
		if(v.length !=5 && v.length !=13) {
			if (!Ext.data.validations.isHex(v)) {
				return false;
			} else {
				if (v.length !=10 && v.length !=26) {
					return false;
				}else {
					return true;
				}
			}
		}else {
			return true;
		}
	},
	'weppwdText' : 'WEP Password must match one of the next two conditions.<br />-It\'s a 5-bit or 13-bit string.<br />-It\'s a 10-bit or 26-bit hexadecimal string.',
	
	//Wlan PSK key
	'wpapwd' :  function (v,field) {
		if(v.length <8 || v.length >63) {
			if (!Ext.data.validations.isHex(v)) {
				return false;
			} else {
				if (v.length !=64) {
					return false;
				}else {
					return true;
				}
			}
		}else {
			return true;
		}
	},
	'wpapwdText' : 'WPA Password must match one of the next two conditions.<br />-It\'s a 8~63 bit string.<br />-It\'s a 64 hexadecimal string.',
	
	//domain_url
	'domain_url': function (v, field) {
        var tmpTips = '';
       
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
            Ext.form.VTypes['domainText'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (Ext.data.validations.isDomainForURL(v)) {
                return true;
            } else {
                return false;
            }
        }
        return true;
    },
    'domain_urlText': 'Please enter a legal domain name or IP address, ex. abc.com or 127.0.0.1',
	
	//domain_url_with_wildchar
	'domain_url_with_wildchar': function (v, field) {
        var tmpTips = '';
       
        var allowBlank = field.allowBlank;
        if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
            Ext.form.VTypes['domainText'] = tmpTips;
            return false;
        }
        if (v.length != 0) {
            if (Ext.data.validations.isDomainWithWildcharForURL(v)) {
                return true;
            } else {
                return false;
            }
        }
        return true;
    },
    'domain_url_with_wildcharText': 'Please enter a legal URL!Wildcard * is supported.',
	
	//domain
	'domain': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainText': 'Please enter a legal domain name, ex. www.example.com',
	
	//domainorip
	'domainorip' :  function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v) 
				|| Ext.data.validations.isIpv4(v) 
				|| Ext.data.validations.isIpv6(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainoripText': 'Please enter a legal domain name or IP address, ex. abc.com or 127.0.0.1',
	
	//pwd
	'pwd': function (v, field) {
		var tmpTips = '';
		if (field.pwd) {
			var minLen = field.pwd.minLength;
			var maxLen = field.pwd.maxLength;
			if (minLen && minLen > v.length) {
				tmpTips += 'The length of password should be equal to or more than&nbsp;' + minLen;
				tmpTips += '&nbsp;chars';
				Ext.form.VTypes['pwdText'] = tmpTips;
				return false;
			}
			if (maxLen && maxLen < v.length) {
				tmpTips += 'The length of password should be equal to or less than&nbsp;' + maxLen;
				tmpTips += '&nbsp;chars';
				Ext.form.VTypes['pwdText'] = tmpTips;
				return false;
			}
		}
		if (Ext.data.validations.checkStrExCludeChinese(v) == false) {
			tmpTips += 'Password cannot contain Chinese characters';
			Ext.form.VTypes['pwdText'] = tmpTips;
			return false;
		}
		return true;
	},
	'pwdText': 'Password length does not match',
	
	//confirm
	'confirm': function (v, field) {
		var tmpTips = '';
		if (field.confirm) {
			var targetObj = Ext.getCmp(field.confirm.targetId);
			var psw = targetObj.getValue();
			if (psw.length != 0 && v != psw) {
				return false;
			}
			if (psw.length == 0 && v.length != 0) {
			tmpTips = 'No need to type password again if you do not specify any password';
				Ext.form.VTypes['confirmText'] = tmpTips;
				return false;
			}
		}
		return true;
	},
	'confirmText': 'Do not match with typed password',
	
	//compare
	'compare': function (v, field) {
		var tmpTips = '';
		var targetObj = Ext.getCmp(field.compare.targetId);
		var targetFieldLabel = field.compare.targetFieldLabel;
		var targetObjVal = targetObj.getValue();
		var selfVal;
		var targetVal;
		var dtype = field.compare.dtype;
		var min = field.compare.min;
		var minVal;
		var max = field.compare.max;
		var maxVal;
		var fieldLabel = field.fieldLabel;
		var operator = field.compare.operator;
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['compareText'] = tmpTips;
			return false;
		}
		
		if(field.compare) {
			if (dtype == 'int') {
				if(!Ext.data.validations.isInt(v)) {
					tmpTips += 'Must be an integer!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = parseInt(v, 10);
				/* if (!Ext.data.validations.isInt(targetObjVal)) {
					return true;
				} */
				if(Ext.data.validations.isInt(targetObjVal)){
					targetVal = parseInt(targetObjVal, 10);
					targetValue = parseInt(targetVal/10)+1;
				}
				minVal = parseInt(min, 10);
				maxVal = parseInt(max, 10);
			} else if (dtype == 'hex') {
				if(!Ext.data.validations.isHex(v)){
					tmpTips += 'Must be a hex number!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = parseInt(v, 16);
				if (!Ext.data.validations.isHex(targetObjVal)) {
					return false;
				}
				targetVal = parseInt(targetObjVal, 16);
				minVal = parseInt(min, 16);
				maxVal = parseInt(max, 16);
			} else if (dtype == 'ip') {
				if(Ext.data.validations.isIpv4(v) == false) {
					tmpTips = 'Please enter a legal IP address';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			} else if (dtype == 'ipx1') {
				if(Ext.data.validations.isIpv4(v, 1) == false) {
					tmpTips = 'Please enter a legal IP address';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 1) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			} else if (dtype == 'ipo') {
				if(Ext.data.validations.isIpv4(v, 1) == false) {
					tmpTips = 'Please enter a legal IP address';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				if(v == '0.0.0.0') {
					tmpTips = 'Can not be 0.0.0.0!';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 1) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					minVal = Ext.data.validations.str2IP(min);
				}
				if (max) {
					maxVal = Ext.data.validations.str2IP(max);
				}
			}else if (dtype == 'ipx2') {
				if(Ext.data.validations.isIpv4(v, 2) == false) {
					tmpTips = 'Please enter a legal IP address';
					Ext.form.VTypes['compareText'] = tmpTips;
					return false;
				}
				selfVal = Ext.data.validations.str2IP(v);
				if(Ext.data.validations.isIpv4(targetObjVal, 2) == false) {
					return false;
				}
				targetVal = Ext.data.validations.str2IP(targetObjVal);
				if (min) {
					var minTips;
					if (typeof min == 'function') {
						minVal = Ext.data.validations.str2IP(min());
						minTips = min();
					} else {
						minVal = Ext.data.validations.str2IP(min);
						minTips = min;
					}
				}
				if (max) {
					var maxTips;
					if (typeof max == 'function') {
						maxVal = Ext.data.validations.str2IP(max());
						maxTips = max();
					} else {
						maxVal = Ext.data.validations.str2IP(max);
						maxTips = max;
					}
				}
			} else if (dtype == 'time') {				
				targetVal = Ext.data.validations.timeStr2Int(targetObjVal);
				selfVal = Ext.data.validations.timeStr2Int(v);				
			} else if (dtype == 'week') {
				selfVal = field.value;
				targetVal = parseInt(targetObjVal, 10);
			}
			
			if ((selfVal < minVal || selfVal > maxVal) && (minVal||minVal == 0) && (maxVal||maxVal == 0)) {
				if(dtype !='ipx2'){
					var minTips = minVal;
					var maxTips = maxVal;
				}
				tmpTips = 'Data overflow!<br/>Range:&nbsp;' + minTips + '~' + maxTips;
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			}
			if (operator == '>' && selfVal <= targetVal) {
				tmpTips += '&nbsp;should be more than&nbsp;' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '<' && selfVal >= targetVal) {
				tmpTips += '&nbsp;should be less than&nbsp;' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '>=' && selfVal < targetVal) {
				tmpTips += 'The end IP cannot be less than the start IP' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '<=' && selfVal > targetVal) {
				tmpTips += '&nbsp;should be less than or equal to&nbsp;' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '' && selfVal < targetValue) {
				tmpTips += '&nbsp;should be later than or equal to&nbsp;' + (targetFieldLabel ? targetFieldLabel : targetValue);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} else if (operator == '' && selfVal > targetVal) {
				tmpTips += '&nbsp;should be less than or equal to&nbsp;' + (targetFieldLabel ? targetFieldLabel : targetObjVal);
				Ext.form.VTypes['compareText'] = tmpTips;
				return false;
			} 
		}
		return true;
	},
	'compareText': 'Please enter a legal value!',
	
	//multitimecomp
	'multitimecomp' : function (v, field) {
		var tmpTips = '';
		var startTargetObj = Ext.getCmp(field.compare.startTargetId);
		var endTargetObj = Ext.getCmp(field.compare.endTargetId);
		var startTimeObj = Ext.getCmp(field.compare.startTimeId);		
		var startTargetVal = startTargetObj.getValue();
		var endTargetVal = endTargetObj.getValue();
		var startTimeVal = startTimeObj.getValue();
		var selfVal;
		//var targetVal;
		var dtype = field.compare.dtype;
		var startFieldLabel = startTargetObj.fieldLabel;
		var endFieldLabel = endTargetObj.fieldLabel;
		var operator = field.compare.operator;
		if (startFieldLabel && startFieldLabel.length != 0) {
			startFiledLabel = 'Start time';
		}
		if (endFieldLabel && endFieldLabel.length != 0) {
			tmpTips = endFieldLabel;
		} else {
			tmpTips = 'End time ';
		}
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['multitimecompText'] = tmpTips;
			return false;
		}		
		if(field.compare) {
			if (dtype == 'date') {				
				startTargetVal = startTargetVal.toString();
				endTargetVal = endTargetVal.toString();
				startTimeVal = Ext.data.validations.timeStr2Int(startTimeVal);
				selfVal = Ext.data.validations.timeStr2Int(v);
			} else if (dtype == 'week') {
				startTargetVal = parseInt(startTargetVal, 10);
				endTargetVal = parseInt(endTargetVal, 10);
				startTimeVal = Ext.data.validations.timeStr2Int(startTimeVal);
				selfVal = Ext.data.validations.timeStr2Int(v);				
			}
			
			if (operator == '>=' && (startTargetVal == endTargetVal && startTimeVal > selfVal)) {
				tmpTips += '&nbsp;should be later than or equal to&nbsp;' + (startFieldLabel ? startFieldLabel : "Start time");
				Ext.form.VTypes['multitimecompText'] = tmpTips;
				return false;
			}
		}
		return true;
	},
	'multitimecompText' : 'Please enter a legal value!',
	
	//daterange
	'daterange': function(val, field) {
        var date = field.parseDate(val);

        if(!date){
            return;
        }
        if (field.startDateField && (!this.dateRangeMax || (date.getTime() != this.dateRangeMax.getTime()))) {
            var start = Ext.getCmp(field.startDateField);
            start.setMaxValue(date);
            start.validate();
            this.dateRangeMax = date;
        } 
        else if (field.endDateField && (!this.dateRangeMin || (date.getTime() != this.dateRangeMin.getTime()))) {
            var end = Ext.getCmp(field.endDateField);
            end.setMinValue(date);
            end.validate();
            this.dateRangeMin = date;
        }
        
        return true;
    },
	'daterangeText': 'Please enter a legal date',
	
	/*
	*  check input value type and range
	*  向form添加组件时组件配置validate属性格式如下：
	*  dtype: hex, int...持续扩展中...
	*  min: 自身匹配的最小值
	*  max: 自身匹配的最大值
	*  
		vtype: 'range',
		range: {
			dtype: 'hex',
			min: '0001',
			max: 'FFFFFFFF'
		}
	*  
	* */
	'range' : function (v, field) {
		var tmpTips = '';
		
		if(field.range) {
			var dtype = field.range.dtype;
			var min = field.range.min;
			var max = field.range.max;
			var unsigned = field.range.unsigned || true; // handle case like "+123"
			
			var exception = null;
			if( field.range.exception != undefined ){
				exception = field.range.exception;	
			}
			
			var tmpVal = 0;
			var allowBlank = field.allowBlank;	
			if (!allowBlank && v.length == 0) {
				tmpTips += 'It cannot be null';
				Ext.form.VTypes['rangeText'] = tmpTips;
				return false;
			}
			
			if (dtype == 'int') {
				if (Ext.data.validations.isInt(v) == false || (unsigned && /^\+/.test(v))) {
					tmpTips = 'The format of data is wrong! <br/> Data should be integer';
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
				tmpVal = parseInt(v, 10);
				
				if(null == exception){
					if (tmpVal > parseInt(max, 10) || tmpVal < parseInt(min, 10)) {
						tmpTips = 'Data overflow!&nbsp;<br/>Range:&nbsp;' + min + '~' + max;
						Ext.form.VTypes['rangeText'] = tmpTips;
							return false;
						}					
				}else{
					if (tmpVal != parseInt(exception, 10)){
						if (tmpVal > parseInt(max, 10) || tmpVal < parseInt(min, 10)) {
							tmpTips += 'Data overflow!&nbsp;<br/>Range:&nbsp;'+ exception +'or' + min + '~' + max;
							Ext.form.VTypes['rangeText'] = tmpTips;
							return false;
						}
					}	
				}
			} else if (dtype == 'hex') {
				if (!Ext.data.validations.isHex(v)) {
					tmpTips = 'The format of data is wrong!&nbsp;<br/>Data should be hex';
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
				tmpVal = parseInt(v, 16);
				if (tmpVal > parseInt(max, 16) || tmpVal < parseInt(min, 16)) {
					tmpTips = 'Data overflow!&nbsp;<br/>Range:&nbsp;' + min + '~' + max;
					Ext.form.VTypes['rangeText'] = tmpTips;
					return false;
				}
			}
		}
		
		return true;
	},
	'rangeText' : 'Please enter a legal value!',
	
	'cellphone' : function (v, field) {
		
		var min = field.minLength;
		var max = field.maxLength;
		if ( v.length == 0 ){
			return true;
		}
		if (v.length < min || v.length > max) {
			return false;
		}
		if (!v.match(Ext.data.validations.numRegex)) {
			return false;
		}
		return true;
	},
	'cellphoneText': 'Please input a legal mobile number!<br/>',
	
	//hexrange
	'hexrange': function (v, field) {
		var tmpTips = '';
		if(field.hexrange) {
			
			var min = field.hexrange.min;
			var max = field.hexrange.max;
			var tmpVal = 0;
			var allowBlank = field.allowBlank;
			
			if (!allowBlank && v.length == 0) {
				tmpTips += 'It cannot be null';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}

			if (!Ext.data.validations.isHex(v)) {
				tmpTips = 'The format of data is wrong!<br/>Data should be hex';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}
			tmpVal = parseInt(v, 16);
			if (tmpVal > parseInt(max, 16) || tmpVal < parseInt(min, 16)) {
				tmpTips = 'Data overflow!';
				Ext.form.VTypes['hexrangeText'] = tmpTips;
				return false;
			}

		}

		return true;
	},
	'hexrangeText' : 'Please enter a legal value!',
	
	//Url
	'url': function (v, field) {
		return Ext.data.validations.isUrl(v);
	},
	'urlText': 'Please enter a legal url, example：http://www.example.com',
	
	//snmpmask
	'snmpmask': function (v, field) {
		var tmpTips = '';
		var targetIp = Ext.getCmp(field.snmpmask.targetId);
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['snmpmaskText'] = tmpTips;
			return false;
		}

		if (v.length != 0) {
			if (Ext.data.validations.isNumNetmask(v, 'ipv4') == true) {
				if(targetIp.isValid() && targetIp.getValue()){
					if(!Ext.data.validations.checkBrIp(targetIp.getValue(),v)){
							targetIp.markInvalid("IP address should not be a loopback,multicast,broadcast address or network ID");
						}else{
							targetIp.clearInvalid();
						}
				}
				return true;
			}
			if (Ext.data.validations.isWildNetmaskV4(v) == true) {
				if(targetIp.isValid()  && targetIp.getValue()){
					if(!Ext.data.validations.checkBrIp(targetIp.getValue(),v)){
							targetIp.markInvalid("IP address should not be a loopback,multicast,broadcast address or network ID");
						}else{
							targetIp.clearInvalid();
						}
				}		
				return true;
			}
			return false;
		}
		return true;
	},
	'snmpmaskText': 'Please enter a legal netmask!',
	
	//snmpIp
	'snmpip' : function (v, field) {
		var tmpTips = '';
		var targetMask = Ext.getCmp(field.snmpip.targetId).getValue();
		var isIPV4 = false;	
		this.snmpipText = 'Please enter a legal IP address!';
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipx0Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 2);
		if (isIPV4) {
			if(targetMask && !checkBrIp(v,targetMask)){
					this.snmpipText = "IP address should not be a loopback,multicast,broadcast address or network ID"
					return false;
			}
			return true;
		}
		return false;
	},
	'snmpipText' : 'Please enter a legal IP address!',
	
	//ipx3
	'ipx3' : function (v, field) {
		var tmpTips = '';
		var isIPV4 = false;
		this.ipx3Text = 'Please enter a legal IP address!';
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['ipx3Text'] = tmpTips;
			return false;
		}
		isIPV4 = Ext.data.validations.isIpv4(v, 3);
		
		if (isIPV4) {			//由于暂不支持IPv6,在条件内去除"|| isIPV6"
			var reg = /\d{1,3}/;
			var firstIp = v.match(reg);
			if(v == "127.0.0.1" || (firstIp >= "224" && firstIp<"240")){
				this.ipx3Text = "IP address should not be a loopback or multicast";
				return false;
			}
			return true;
		}
		return false;
	},
	'ipx3Text': 'Please enter a legal IP address!',
	
	//domainorip2
	'domainorip2': function (v, field) {
		var tmpTips = '';
		
		var allowBlank = field.allowBlank;
		if (!allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['domainText'] = tmpTips;
			return false;
		}
		if (v.length != 0) {
			if (Ext.data.validations.isDomain(v) 
				|| Ext.data.validations.isIpv4OrNetMask(v) 
				|| Ext.data.validations.isIpv6(v)) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'domainorip2Text': 'Please enter a legal domain name or IP address/Mask, ex. abc.com or 127.0.0.1/24',
	'wildcardmask': function (v, field) {
		var me = this, tmpTips = '';

		if (!field.allowBlank && v.length == 0) {
			tmpTips += 'It cannot be null';
			Ext.form.VTypes['wildcardmaskText'] = tmpTips;
			return false;
		}
		if (!Ext.data.validations.isIpv4(v)) {
			tmpTips += me['ipv4Text'];
			Ext.form.VTypes['wildcardmaskText'] = tmpTips;
			return false;
		}
		if (32 - hscore.utils.Utils.ipToMaskInt(v) > 8) {
			return false;
		}
		return true;
	},
	'wildcardmaskText' : 'Wildcard netmask with more than 8 bit zeros is not supported',
	'pathValidator':function (value){
		if(value == "") return true;
		var result = true;
		
		//匹配www.aa.com,www.bb.com		
		var reg = /^\//; 

		result = reg.test(value);
		return result;
	},
	'pathValidatorText':'Please input valid path,like：/tmp',
	'cellphone' : function (v, field) {
		
		var min = field.minLength;
		var max = field.maxLength;
		if ( v.length == 0 ){
			return true;
		}
		if (v.length < min || v.length > max) {
			return false;
		}
		if (!/^[0-9]+([0-9]+|\-)*[0-9]+$/.test(v) || /\-{2,}/.test(v)) {
			return false;
		}
		return true;
	},
	'cellphoneText': 'Please enter a legal cellphone number',
	'dstip': function (v, field) {
		var me = this;
			
		if (!me.ip(v, field)) {
			me['dstipText'] = me['ipText'];
			return false;
		}
		
		if (me.ip(v, field) && /127\.0\.0\.1/.test(v)) {
			 me['dstipText'] = 'destination cannot be 127.0.0.1 &nbsp;';
			return false;
		}
		return true;
	},
	'dstipText' : 'destination cannot be 127.0.0.1',
	
	/************测试工具**************/
	/**
	 * 检查是否为DNS
	 */
	'tldns' : function(value) {
		if (value) {
			var flag1 = !Ext.data.validations.checkDomainName(value);
			var flag2 = !Ext.data.validations.checkIPV4(value, true, true);
			if (flag1 && flag2) {
				return true;
			} else {
				return false;
			}
		}
		return true;
	},
	'tldnsText' : 'Domain name (ex.abc.com).Domain name cannot be longer than 63 chars', //getLangStr('testtool_rule_1'),
	/**
	 * 检查是否可以进行ping
	 */
	'tlping' : function(value) {
		if (value) {
			var flag = Ext.data.validations.checkIPorDomainName(value, true, false);
			if (flag) {
				return false;
			} else {
				return true;
			}
		}
		return true;
	},
	'tlpingText' : 'Domain name or IP address (ex.abc.com or 127.0.0.1).Domain name cannot be longer than 63 chars',
	
	'portalfield' : function (val, field) {
		var ml = field.maxLength;
		if (val == null || val == '')
			return false;
		if (val.length > ml)
			return false;
		if (/ /.test(val)) {
			Ext.form.VTypes.portalFieldText = 'Invalid value in this field';
			return false;
		}
		var portalReg = /^http(s?):\/\//;
		if (!portalReg.test(val.toLowerCase())) {
			Ext.form.VTypes.portalFieldText = 'This field must with http: // or https: // at the beginning of';
			return false;
		}
		return true;
	},
	'portalfieldText' : 'This field must with http: // or https: // at the beginning of'
});
